from django.db import models

# Create your models here.




class saltconfig(models.Model):
    s_name = models.CharField(max_length=255,default="yyp")
    s_ip = models.CharField(max_length=255,default="yyp")
    s_login = models.CharField(max_length=36,default="yyp")
    s_version = models.CharField(max_length=36,default="yyp")
    s_gitlab = models.CharField(max_length=255,default="yyp")
    s_init = models.CharField(max_length=13,default="yyp")
    s_file_roots = models.CharField(max_length=13,default="/srv/salt")
    s_pillar_roots = models.CharField(max_length=13, default="/srv/pillar")
    s_cmd = models.ManyToManyField("cmdlist")
class projects(models.Model):
    p_name = models.CharField(max_length=255,default="yyp")
    p_name_alias = models.CharField(max_length=255,default="yyp")
    p_cdn = models.CharField(max_length=255, default="yyp")
    p_cdn_dir = models.CharField(max_length=255, default="yyp")
    p_salt = models.ManyToManyField("saltconfig")

class sysconfig(models.Model):
    ssh_user = models.CharField(max_length=255,default="yyp")
    ssh_pwd = models.CharField(max_length=255,default="yyp")
    ssh_port = models.CharField(max_length=255,default="yyp")
    ssh_key = models.CharField(max_length=255,default="yyp")

class cmdlist(models.Model):
    cmd_command = models.CharField(max_length=255,default="yyp")
    cmd_type = models.CharField(max_length=10,default="yyp")

class hosts(models.Model):
    host_name = models.CharField(max_length=255,default="yyp")
    host_ip = models.CharField(max_length=255,default="yyp")
    login_type = models.CharField(max_length=255,default="yyp")
    init_status = models.CharField(max_length=255, default="1")
    host_version = models.CharField(max_length=255, default="c7")
    host_project = models.ManyToManyField("projects")

class users(models.Model):
    user_name = models.CharField(max_length=255)
    user_name_cn = models.CharField(max_length=255)
    user_password = models.CharField(max_length=255)
    user_admin = models.CharField(max_length=32)
    user_project = models.ManyToManyField("projects")
    user_permission = models.ManyToManyField("permission_url")

class permission_url(models.Model):
    permission_name = models.CharField(max_length=255)
    permission_url = models.CharField(max_length=255)

